# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt

from __future__ import print_function, unicode_literals

import frappe


def after_install():
    """ change via property setter does not work for core DocType like DocField"""

    try:
        filters = {'fieldname':'fieldtype',
             'parent': ('in',['DocField','Custom Field','Customize Form Field']),
             'parenttype':'DocType'}
        options = frappe.db.get_value('DocField', filters, 'options')
        fieldtype = '\nLink MultiSelect'    
        if options and fieldtype not in options:
            options = options.replace('\nLink',f'\nLink{fieldtype}')
            frappe.db.set_value('DocField', filters, 'options', options)
            frappe.db.commit()
    except:
        pass